const mongoose = require('mongoose')
/**
 * @param name 英雄名称
 * @param desc 介绍
 * @param avatar 头像地址
 * @param categories 类型数组
 * @param scores 指数 diffcult->难度指数 skill->技能指数 attack->攻击指数 survive->生存指数
 * @param skills 技能数组
 * @param tips 技巧 usage->使用技巧 battle->对线技巧 team->团战技巧
 * @param relation 英雄关系 partner->最佳搭档  restraint->克制谁 （v2版本）
 * @param itemRecom 出装建议 good->顺风 bad->逆风 （v2版本）
 */
const schema = new mongoose.Schema({
  name: {type: String},
  desc: {type: String},
  avatar: {type: String},
  categories: [{type: mongoose.SchemaTypes.ObjectId,ref: 'Category'}],
  scores: {
    diffcult: {type: Number},
    skill: {type: Number},
    attack: {type: Number},
    survive: {type: Number}
  },
  skills: [{
    icon: {type: String},
    name: {type: String},
    desc: {type: String},
    tip: {type: String}
  }],
  itemRecom: {
    good: {
      items: [{type: mongoose.SchemaTypes.ObjectId, ref:'Item'}]
    },
    bad: {
      items: [{type: mongoose.SchemaTypes.ObjectId, ref:'Item'}]
    }
  },
  tips: {
    usage: {type: String},
    battle: {type: String},
    team: {type: String},
  }
  // },
  // relation: {
  //   partner: [{
  //     avatar: {type: mongoose.SchemaTypes.ObjectId, ref:'Hero'},
  //     name: {type: mongoose.SchemaTypes.ObjectId, ref:'Hero'},
  //     desc: {type: String}
  //   }],
  //   restraint: [{
  //     avatar: {type: mongoose.SchemaTypes.ObjectId, ref:'Hero'},
  //     name: {type: mongoose.SchemaTypes.ObjectId, ref:'Hero'},
  //     desc: {type: String}
  //   }]
  // }
})

module.exports = mongoose.model('Hero',schema)